home *** CD-ROM | disk | FTP | other *** search
- // This demonstrates a help screen that only covers part of the screen
-
- // IMPORTANT: If you change the number of lines, buf[] should reflect this.
- // Never use more than 24 lines since that is all that can display on Telix.
- // buf[] should be set to (160 * number of lines) to allow enough space to
- // store the char and attribute.
-
- // IMPORTANT: Variables remarked *** means changed from full screen
- // and will probably need changing if you change the size
-
- str buf[2560]; // *** array to store screen in - 16 lines by 160 per
- // line including char and attribute
-
- main()
-
- {
- int f,x,cx,cy;
- str s[100];
-
- str fname[67] = "cis2.hlp"; // name of help screen file
- // if you include the full-path name, you will be able to access this
- // from any directory
-
- int color = 79; // change this to suit your tastes
- int c=7; // column position to start *** from full screen
- int r=1; // row position to start *** from full screen
-
- int lines=16; // number of lines of text in file *** from full screen
-
- cy = gety(); // get current cursor position (x and y)
- cx = getx();
- cursor_onoff(0); // turn cursor off
-
- for (x=r;x<lines+r;x = x + 1) // save screen into array
- vgetchrsa(0, x, buf,(x*160), 80); // saves whole row into array
-
- x = r;
- f = fopen(fname, "r"); // open file name to put on screen
- if (ferror(f))
- {
- prints("Error opening file for reading ( File should be in Telix DIR )" );
- // include the full path name to avoid this error
- }
- else
- {
- while (1) // displays contents of text file
- {
- fgets(s, 100, f);
- if( feof(f) )
- break;
- pstraxy( s, c, x, color);
- x = x + 1;
- }
- }
- fclose(f);
-
- x = inkeyw(); // if key = Esc, restore screen, otherwise leave
- if (x == 27) // help screen intact while in terminal mode
- for (x=r;x<lines+r;x = x + 1)
- vputchrsa( 0, x, buf, (x*160), 80 );
-
- cursor_onoff(1); // turn cursor back on
- gotoxy(cx,cy); // restore cursor to its postion
- }
-
-